ÄúµÄλÖãºÑ°ÃÎÍøÊ×Ò³£¾±à³ÌÀÖÔ°£¾VBScript£¾VBScript


objects constants operators statements functions properties methods






FUNCTION:  Mid( )

Mid(String, Start, Length)

The Mid function returns the portion of the designated string for a designated length starting from any position in the string.


There are two mandatory arguments.

String

The String argument is the name of the string you wish to truncate.


Start

The Start argument is a numeric position anywhere in the string counting from the left side. The portion of the string to the left of this position will be discarded.

Code:
<% =Mid("abcde fghij klmno pqrst uvwxyz", 8) %>

Output:
ghij klmno pqrst uvwxyz


There is one optional argument.

Length

The optional Length argument is the number of characters (including blanks) in the string you wish to save counting from the position designated by the Start argument.

Code:
<% =Mid("abcde fghij klmno pqrst uvwxyz", 8, 7) %>

Output:
ghij kl